<template>
	<view class="adds">
		<view class="add_body">
			<view class="add_top">
				<view class="ref" @click="toaddsindex">
					<text class="iconfont"
						style="color: #FFFFFF; background-color: #f70000; border-radius: 50%;padding: 8px;">&#xe601;</text><text
						style="margin: 0 10px 0 10px;">新增收货地址</text><text class="iconfont"
						style="color: #2d2d2d;">&#xe63f;</text>
				</view>
			</view>

			<view class="add_main">
				<view class="add_main_body" v-for="item in datalist.list">

					<view style="display: flex;justify-content: center;flex-direction: column;">
						<view style="display: flex;justify-content: center;flex-direction: column;">
							<text @click="xuanze(item)"
								style="display: block; width: 20px; height: 20px;border: 1px solid #9c9c9c;border-radius: 20px; text-align: center; margin-right: 5px; color: #FFFFFF;">0</text>

						</view>
					</view>
					<view class="text_sd">
						<view>
							<text style="margin-right: 5px; font-weight: 600;">{{item.name}}</text><text>{{item.phone}}
								<text v-show="item.top" style="font-size: 1.1rem;margin-left: 5px; color: #53C21D;"
									class="iconfont">&#xe62d;</text></text>
						</view>
						<view style="color: #555555;">
							{{item.city}}{{item.address}}
						</view>
					</view>
					<view @click="toaddupdate(item)" class="text_sds" style=" width: 38px;">
						编辑
					</view>


				</view>
			</view>
		</view>



	</view>
</template>

<script>
	export default {
		data() {
			return {
				value1: 0,
				datalist: [],
				xianshi: false,
				falsesd: true,
				truesd: false,

			}
		},
		onShow() {
			this.logaddlist()
		},
		onUnload() {
			uni.reLaunch({
				url: '../dindan/dindan'
			})
		},

		methods: {
			xuanze(item){
				uni.setStorage({
					key:'xuanadds',
					data:item
				})
				uni.navigateTo({
					url:'../dindan/dindan'
				})
			},

			groupChange(n) {
				console.log('启动', n);
			},
			radioChange(n) {
				console.log('wei', n);
			},

			toaddsindex() {
				uni.navigateTo({
					url: '../addsindex/addsindex'
				})
			},
			toaddupdate(item) {

				uni.setStorage({
					key: 'addslist',
					data: item,
					success: function() {
						console.log('success');
					}
				})

				uni.navigateTo({
					url: '../addupdate/addupdate'
				})
			},
			logaddlist() {
				var this_ = this
				this.$http.getaddress().then(res => {
					console.log(res.data);
					this_.datalist = res.data
				})
			}
		}
	}
</script>

<style>
	@font-face {
		font-family: 'iconfont';
		/* Project id 3367375 */
		src: url('//at.alicdn.com/t/font_3367375_jmb67dktxnn.woff2?t=1652153394004') format('woff2'),
			url('//at.alicdn.com/t/font_3367375_jmb67dktxnn.woff?t=1652153394004') format('woff'),
			url('//at.alicdn.com/t/font_3367375_jmb67dktxnn.ttf?t=1652153394004') format('truetype');
	}

	.texts {
		font-size: 12px;
		display: flex;
		justify-content: center;
		flex-direction: column;
	}


	.iconfont {
		font-family: "iconfont" !important;
		font-size: 16px;
		font-style: normal;
		-webkit-font-smoothing: antialiased;
		-webkit-text-stroke-width: 0.2px;
		-moz-osx-font-smoothing: grayscale;
	}

	.adds {
		width: 100%;
		background-color: #f0f0f0;
		position: fixed;
		height: 100%;
	}




	.add_top {
		text-align: center;
		display: flex;
		justify-content: center;
		flex-direction: column;
		width: 100%;
		height: 50px;
		font-size: 16px;
		border-bottom: 1px solid #cecece;
		background-color: #FFFFFF;
	}

	.add_body {
		width: 100%;
	}

	.add_main_body {
		display: flex;
		justify-content: space-between;
		padding: 10px;
		margin: 10px;
		background-color: #FFFFFF;
		border-radius: 5px;
		text-align: 15px;
		height: 60px;
	}

	.text_sd {
		display: flex;
		justify-content: space-around;
		flex-direction: column;
		width: 85%;
	}

	.text_sds {
		display: flex;
		justify-content: center;
		flex-direction: column;
		color: #555555;
	}
</style>
